package main.java.com.service.impl;

import main.java.com.dao.DishDao;
import main.java.com.dao.SetmealDao;
import main.java.com.dao.impl.DishDaoImpl;
import main.java.com.dao.impl.SetmealDaoImpl;
import main.java.com.entity.Setmeal;
import main.java.com.entity.SetmealDish;
import main.java.com.service.SetmealService;

import java.util.List;

public class SetmealServiceImpl implements SetmealService {
    private SetmealDao setmealDao = new SetmealDaoImpl();

    @Override
    public List<Setmeal> getAllSetmeal(int page, int pageSize, String setmealName, Integer status) {
        int offset = (page - 1) * pageSize;
        return setmealDao.getAllSetmeal(offset, pageSize, setmealName, status);
    }

    @Override
    public int getSetmealCount(String setmealName, Integer status) {
        return setmealDao.getSetmealCount(setmealName,status);
    }

    @Override
    public void addSetmeal(Setmeal setmeal) {
        setmealDao.addSetmeal(setmeal);
    }

    @Override
    public void updateSetmealStatus(Long id, Integer status) {
        setmealDao.updateSetmealStatus(id,status);
    }

    @Override
    public int deleteSetmeal(Long id) {
        return setmealDao.deleteSetmeal(id);
    }

    @Override
    public int deleteSetmeal_dish(Long id) {
        return setmealDao.deleteSetmeal_dish(id);
    }

    @Override
    public int batchDeleteDishes(List<Long> ids) {
        return setmealDao.batchDeleteDishes(ids);
    }

    @Override
    public int batchUpdateStatus(List<Long> ids, int status) {
        return setmealDao.batchUpdateStatus(ids,status);
    }

    @Override
    public void addSetmeal_dish(SetmealDish setmealDish) {
        setmealDao.addSetmeal_dish(setmealDish);
    }

    @Override
    public Long getSetmealIdByName(String name) {
        return setmealDao.getSetmealIdByName(name);
    }

}
